Skip to content

gh-114746: Avoid quadratic behavior in free-threaded GC#114817

Merged
encukou merged 1 commit intopython:mainfrom
colesbury:gh-114746-gc
Feb 1, 2024
Merged

gh-114746: Avoid quadratic behavior in free-threaded GC#114817
encukou merged 1 commit intopython:mainfrom
colesbury:gh-114746-gc

Conversation

@colesbury
Copy link
Contributor

@colesbury colesbury commented Jan 31, 2024

The free-threaded build's GC implementation is non-generational, but was scheduled as if it were collecting a young generation leading to quadratic behavior. This increases the minimum threshold and scales it to the number of live objects as we do for the old generation in the default build.

Note that the scheduling is still not thread-safe without the GIL. Those changes will come in later PRs.

A few tests, like "test_sneaky_frame_object" rely on prompt scheduling of the GC. For now, to keep that test passing, we disable the scaled threshold after calls like gc.set_threshold(1, 0, 0).

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants